package com.designpattern.observer;

import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.List;

public class Test {

    private List<ObserverUser> observerUsers = new ArrayList<ObserverUser>();

    public void addObserver(ObserverUser observerUser) {
        observerUsers.add(observerUser);
    }

    public void updateStatus() {
        for (ObserverUser observerUser : observerUsers) {
            observerUser.setStatus("老板来了 工作中");
        }
    }

    public void workStatus(){
        System.out.println(JSON.toJSONString(observerUsers));
    }
}
